﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="download.aspx.cs" Inherits="RMSWebService.download" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>
    </form>
</body>
</html>
<script type="text/javascript">
    var search = location.search
    var watermark_txt = ''
    var fileName = '';
    var url = '';
    if (search.indexOf('&') !== -1) {
        url = search.split('&')[0].replace('?', '')
        fileName = decodeURIComponent(search.split('&')[1].split('=')[1])
    }


    let link = document.createElement("a"); //创建a标签

    //   link.style.display = "none"; //使其隐藏
    link.href = url; //赋予文件下载地址
    link.setAttribute("download", fileName); //设置下载属性 以及文件名
    //link.setAttribute("target", "_blank");
    document.body.appendChild(link); //a标签插至页面中
    link.click(function (e, a) {
        console.log(e, a)
    }); //强制触发a标签事件
    if (navigator.userAgent.toLowerCase().indexOf('se 2.x') > -1 ? true : false) {
        setTimeout(function () {
            window.close();
        }, 10000)
    } else {
        setTimeout(function () {
            window.close();
        }, 4000)
        //window.close();
    }
</script>
